/**
 * 
 */
package cyclopean.world;

import javagame.core.main.GameState;
import javagame.core.main.Time;

// TODO Javadoc
/**
 * 
 *
 * @author Jaco van der Westhuizen
 */
public class WorldState extends GameState
{
	public WorldState()
	{
		super(new WorldScreen());
	}

	/* (non-Javadoc)
     * @see javagame.core.main.GameState#update(javagame.core.main.Time)
     */
    @Override
    public void update(Time elapsed)
    {
	    super.update(elapsed);
	    
        World.update(elapsed);
    }

	/* (non-Javadoc)
     * @see javagame.core.main.GameState#onEnter(javagame.core.main.GameState)
     */
    @Override
    public void onEnter(GameState prevGameState)
    {
	    super.onEnter(prevGameState);

	    // TODO Move code to menu option
		World.generate();

		((WorldScreen)screen).player.setPawn(World.spawnPlayerPawn());
		
		// TODO Grab mouse
    }

	/* (non-Javadoc)
     * @see javagame.core.main.GameState#onLeave(javagame.core.main.GameState)
     */
    @Override
    public void onLeave(GameState nextGameState)
    {
	    super.onLeave(nextGameState);

	    // TODO Release mouse
    }
}
